Quiz 9
We'll cover the following
Question # 1
TRUNCATE tblA;
What will be the outcome of this query?
A)
The relationships defined on this table with other tables, the integrity checks and constraints, access privileges and other grants that the table has are deleted along with the data in the table.
B)
The relationships defined on this table with other tables, the integrity checks and constraints, access privileges and other grants that the table has are not deleted and the table retains its original structure.
Question # 2
Which statement deletes rows, frees the space containing the table but cannot be rolled back?
A)
DELETE
B)
TRUNCATE
Question # 3
How can you create an empty table from an existing table?
A)
CREATE EMPTY TABLE tblCopy FROM tbl;
B)
SELECT * INTO tblCopy from tbl WHERE 1=2;
C)
SELECT * INTO tblCopy from tbl WHERE 1=1;
Question # 4
Which operators can be used in query for pattern matching?
A)
LIKE
B)
COMPARE
C)
REGEXP
D)
MATCH
Question # 5#
Consider a table with one col having integer data type as follows:
ID |
---|
1 |
0 |
0 |
0 |
1 |
0 |
1 |
1 |
Write a query to change the values of Col1 from 1 to 0 and from 0 to 1.
We can simply subtract each value from 1 to get the opposite value as follows:
UPDATE tbl
SET Col1 = 1 - Col1;